{% extends "student/layout.html" %}

{% set page_title = __('查看学习记录') %}

{% block content %}
<div class="m-scontent">
{% if current_user.course_type == 'course_adults' or current_user.course_type == 'course_xi_yang_hong' %}
 <div class="m-table-top">
    <span class="sum-score">{{__('总分')}}</span>
    <span class="study-time">{{__('学习时间')}}</span>
    <span class="kala">{{__('卡拉PK')}}</span>
    <span class="kala">{{__('分句PK')}}</span>
    <span class="pk_score_slow">{{__('曲谱PK(慢速)')}}</span>
    <span class="pk_score_mid">{{__('曲谱PK(中速)')}}</span>
    <span class="qupu">{{__('曲谱PK(原速)')}}</span>
    <span class="act">{{__('小考核－演奏')}}</span>
</div>
<ul class="table-record table table-responsive" id="study_records">
    {% for d in data %}
        <li>
            <span class="sum-score col">
                <span class="{{ d.remark_class }}">{{__(d.remark)}}</span>
            </span>
            <span class="study-time col" onclick="location.href='{{ url_for('student.detail', course_map='map1', lesson_id=d.lesson_id) }}'">
                <div class="date">
                 {{ __(d.time[5:7] + '月') }}{{ d.time[8:] }}{{__('日')}}
                </div>
                <div class="name" id="{{ d.lesson_id }}">{{ d.number }}.{{ __(d.lesson) }}</div>
            </span>
            <span class="col kala {% if 'pk_kara' not in d %}notgoing">{{__('未进行')}}{% else %}">
                    {% if not d.pk_kara.score %}
                        {{__('无卡拉PK')}}
                    {% else %}
                        {{ d.pk_kara.score}}
                    {% endif %}
                {% endif %}
            </span>
            <span class="col kala {% if 'pk_part' not in d %}notgoing">{{__('未进行')}}{% else %}">
                    {% if not d.pk_part.score %}
                        {{__('无分句PK')}}
                    {% else %}
                        {{ d.pk_part.score}}
                    {% endif %}
                {% endif %}
            </span>
        </li>
    {% endfor %}
</ul>
{% else %}
 <div class="m-table-top">
    <span class="sum-score">{{__('总分')}}</span>
    <span class="study-time">{{__('学习时间')}}</span>
    <span class="kala">{{__('卡拉PK')}}</span>
    {% if system_version == "1" %}
    <span class="qupu">{{__('曲谱PK')}}</span>
    <span class="nolight">{{__('无灯PK')}}</span>
    {% else %}
    <span class="pk_score_slow">{{__('曲谱PK(慢速)')}}</span>
    <span class="pk_score_mid">{{__('曲谱PK(中速)')}}</span>
    <span class="qupu">{{__('曲谱PK(原速)')}}</span>
    {% endif %}
    <span class="act">{{__('小考核－演奏')}}</span>
    <span class="theory">{{__('小考核－乐理')}}</span>
    <span class="listen">{{__('小考核－听力')}}</span>
</div>
<ul class="table-record table table-responsive" id="study_records">

        {% for d in data %}
        <li>
            {% if d.number == 1 %}
            <span class="sum-score col">
                <span class="great">{{__('优秀')}}</span></span>
            <span class="study-time col">
                <div class="date">
                     {{ __(d.time[5:7] + '月') }}{{ d.time[8:] }}{{__('日')}}
                </div>
                <div class="name" id="music_box">1.{{__('彩虹')}}</div>
            </span>
            <span class="col notgoing" style="width:400px;text-align:center">{{__('本课无PK/小考核')}}</span>
            {% elif d.number == 2 %}
            <span class="sum-score col">
                <span class="great">{{__('优秀')}}</span></span>
            <span class="study-time col">
                <div class="date">
                     {{ __(d.time[5:7] + '月') }}{{ d.time[8:] }}{{__('日')}}
                </div>
                <div class="name" id="music_box">2.{{__('跳舞的小蘑菇')}}</div>
            </span>
            <span class="col notgoing" style="width:400px;text-align:center">{{__('本课无PK/小考核')}}</span>
            {% else %}
            <span class="sum-score col" onclick="location.href='{{ url_for('student.detail', course_map='map1', lesson_id=d.lesson_id) }}'"><span class="{{ d.remark_class }}">{{ __(d.remark) }}</span></span>
            <span class="study-time col" onclick="location.href='{{ url_for('student.detail', course_map='map1', lesson_id=d.lesson_id) }}'">
                <div class="date">
                 {{ __(d.time[5:7] + '月') }}{{ d.time[8:] }}{{__('日')}}
                </div>
                <div class="name" id="{{ d.lesson_id }}">{{ d.minor if 'minor' in d else d.number }}.{{ __(d.lesson) }}</div>
            </span>
            <span id="{{ d.pk_kara.activity_id if 'pk_kara' in d }}" class="col kala {% if 'pk_kara' not in d %}notgoing">{{__('未进行')}}{% else %}">
                    {{ d.pk_kara.score }}
            {% endif %}</span>

            {% if system_version == "1" %}
            <span id="{{ d.pk_score.activity_id if 'pk_score' in d }}" class="col qupu {% if 'pk_score' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {{ d.pk_score.score }}{% if d.pk_score.exist_pic %}
                <i class="iconfont icon-file"></i>{% endif %}{% endif %}
            </span>
            <span id="{{ d.pk_no_led.activity_id if 'pk_no_led' in d }}" class="col nolight {% if 'pk_no_led' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {{ d.pk_no_led.score }}{% if d.pk_no_led.exist_pic %}
                <i class="iconfont icon-file"></i>{% endif %}{% endif %}
            </span>
            {% else %}
            <span id="{{ d.pk_score_slow.activity_id if 'pk_score_slow' in d }}" class="pk_score_slow col nolight {% if 'pk_score_slow' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {{ d.pk_score_slow.score }}{% if d.pk_score_slow.exist_pic %}
                <i class="iconfont icon-file"></i>{% endif %}{% endif %}
            </span>
            <span id="{{ d.pk_score_mid.activity_id if 'pk_score_mid' in d }}" class="pk_score_mid col nolight {% if 'pk_score_mid' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {{ d.pk_score_mid.score }}{% if d.pk_score_mid.exist_pic %}
                <i class="iconfont icon-file"></i>{% endif %}{% endif %}
            </span>
            <span id="{{ d.pk_score.activity_id if 'pk_score' in d }}" class="col qupu {% if 'pk_score' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {{ d.pk_score.score}}{% if d.pk_score.exist_pic %}
                <i class="iconfont icon-file"></i>{% endif %}{% endif %}
            </span>
            {% endif %}
            <span id="{{ d.test_play.activity_id if 'test_play' in d }}" class="col act {% if 'test_play' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {{ d.test_play.score }}{% if d.test_play.exist_pic %}
                <i class="iconfont icon-file"></i>{% endif %}{% endif %}
            </span>
            <span id="{{ d.test_music_theory.activity_id if 'test_music_theory' in d }}" class="col theory {% if 'test_music_theory' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {% if not d.test_music_theory.score %}
                    {{__('无此步骤')}}
                {% else %}
                    {{ d.test_music_theory.score }}
                {% endif %}
            {% endif %}</span>
            <span id="{{ d.test_listen.activity_id if 'test_listen' in d }}" class="col listen {% if 'test_listen' not in d %}notgoing">{{__('未进行')}}{% else %}">
                {% if not d.test_listen.score %}
                    {{__('无此步骤')}}
                {% else %}
                    {{ d.test_listen.score }}
                {% endif %}
            {% endif %}</span>
            {% endif %}
        </li>
        {% endfor %}
</ul>
{% endif %}
</div>{% include "school/pagination.html" %}

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog  modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="modalTitle">{{__('成绩单')}}</h4>
      </div>
      <div class="modal-body">

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">{{__('关闭')}}</button>
      </div>
    </div>
  </div>
</div>

{% endblock %}

{% block js %}
<script type="text/javascript">
    $('.icon-file').bind('click',function(){
        var activity_id = $(this).parent().attr('id');
        var url = '/student/record/images/' + activity_id;
        $.get(url, function(data){
            if (data['code']!=0){
                alert(data['msg']);
                return;
            }else{
                var htmlStr = '';
                var imagePaths = data['data']['images'];
                for (var i in imagePaths){
                    htmlStr += '<img width="800px" src="' + imagePaths[i] + '" />';
                }
                $('#myModal .modal-body').html(htmlStr);
                $('#myModal').modal('show');
                $('.modal-body>img').width('800px');
            }

        }, 'json');
    });
    $(function(){
        var total_pages = {{ pagination.pages }} ? {{ pagination.pages }} : 0;
        var current_page = {{ pagination.page }} ? {{ pagination.page }} : 1;
        if(total_pages == current_page){

        }
    });
</script>
{% endblock %}
